<?php defined('SYSPATH') or die('No direct script access.');

class Model_Shop_Mixmarket extends ORM
{  
    protected $_table_name = 'mixmarket_shops'; 
    protected $_reload_on_wakeup = false;

    public function extract_shops($products)
    {
        if (!count($products)) {
            return array();
        }
        
        $ids = array();
        foreach ($products as $product) {
            $ids[$product->shop_id] = $product->shop_id;    
        }
        $tmp_shops = ORM::factory('shop_mixmarket')
                    ->where('id', 'IN', $ids)
                    ->find_all();
        $shops = array();
        foreach ($tmp_shops as $shop) {
            $shops[$shop->id] = $shop;   
        }
        return $shops;
    }
}